home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Visual Basic.60 / COMMON / TOOLS / VB / OLEMSG / SERVER.BAS < prev    next >
Encoding:
BASIC Source File  |  1996-06-15  |  2.0 KB  |  79 lines

  1. Attribute VB_Name = "servermain"
  2. Option Explicit
  3.  
  4. Public Type UserType
  5.     DisplayName As String   ' user's name
  6.     EntryID As String       ' entryid
  7.     ReportIndex As Integer  ' index of the corresponding entry in aReport
  8. End Type
  9.  
  10. Public Type UserListType
  11.     cUsers As Integer       'number of elements in aUsers
  12.     aUsers() As UserType
  13. End Type
  14.  
  15. Public Type CategoryListType
  16.     cCats As Integer        'number of elements in cCats
  17.     aCats() As String
  18. End Type
  19.  
  20.  
  21. Global objSession As Object 'session object
  22.  
  23. Global UserList As UserListType  'list of all the users
  24. Global CategoryList As CategoryListType 'for sending request
  25. Global PayPeriod As Date 'for sending
  26.  
  27. Global Const UserListFile As String = "Users.dat"   'file to save users to
  28. Global Const CatsListFile As String = "categs.dat"  'file to save categories to
  29. Global Const ClientExePath As String = "d:\mapisamp\timecard.cli\client\tmcli.exe" 'path to the client executable
  30. Global Const ClientExeName As String = "tmcli.exe"
  31.  
  32.  
  33. Global Const mapiFileData As Integer = 1
  34. Global Const E_NOT_FOUND As Integer = -1
  35.  
  36.  
  37. Public Sub GetReceivIPCFolder(objFolder As Object)
  38. 'Finds the receiving folder for IPC messages, which is the
  39. 'top folder of the default message store.
  40. 'This is the only folder that is its own parent.
  41.  
  42. On Error GoTo error_olemsg
  43.  
  44. Dim objReceivFolder As Object
  45. Dim objRecFolParent As Object
  46. Dim parentid As String
  47.  
  48. If objSession Is Nothing Then
  49.     MsgBox "Not logged on"
  50.     Exit Sub
  51. End If
  52.  
  53. Set objRecFolParent = objSession.inbox
  54. If objRecFolParent Is Nothing Then
  55.     Exit Sub
  56. End If
  57.  
  58. Do
  59.     Set objReceivFolder = objRecFolParent
  60.     parentid = objReceivFolder.folderid 'get parent's id
  61.     
  62.     Set objRecFolParent = objSession.getfolder(parentid)
  63.     
  64.     If objRecFolParent Is Nothing Then Exit Sub 'error
  65.  
  66. Loop While Not objReceivFolder.id = parentid
  67.  
  68.  
  69. Set objFolder = objReceivFolder
  70.  
  71. Exit Sub
  72.  
  73. error_olemsg:
  74.     MsgBox "Error " & Str(err) & ": " & Error$(err)
  75.     Resume Next
  76.  
  77. End Sub
  78.  
  79.